--------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  V:\Health_IT\Urgent_Care\R2\ucc_replication\BR_EntryThreshold_PCSA_Robust.log
  log type:  text
 opened on:  23 Aug 2023, 15:42:54

. 
. capture program drop brentry_bioprobit_neg

. qui do "brentry_bioprobit_negbin_v3.do"

. 
. putexcel set "BR_EntryThreshold_Robust_V5.xlsx", modify sheet("entry")

. putexcel A1 = "UCC Licensing"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel B1 = "NY and NC"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel C1 = "Year 2014"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel D1 = "Year 2016"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel E1 = "Hosp w/ ED"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel F1 = "Drop Texas"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel G1 = "Urgent in name"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel H1 = "HSA"
file BR_EntryThreshold_Robust_V5.xlsx saved

. putexcel I1 = "All UCCs"
file BR_EntryThreshold_Robust_V5.xlsx saved

. 
. constraint drop

. constrain 1 tot_pop = 1

. constrain 2 tot_pop2 = 1

. 
. // Without UCC licensing
. 
. use "PCSALevelData_v3.dta", clear

. drop if ucc_regulation==1
(133 observations deleted)

. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2)

. eststo clear

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood =    -1342.3
Rescale:      Log likelihood =  -1073.046
Rescale eq:   Log likelihood = -685.60339
Iteration 0:  Log likelihood =   -1379.16  (not concave)
Iteration 1:  Log likelihood = -1132.7182  (not concave)
Iteration 2:  Log likelihood = -1039.4219  (not concave)
Iteration 3:  Log likelihood = -964.63872  (not concave)
Iteration 4:  Log likelihood = -926.19624  (not concave)
Iteration 5:  Log likelihood =  -866.2733  (not concave)
Iteration 6:  Log likelihood = -831.14443  (not concave)
Iteration 7:  Log likelihood = -752.43176  (not concave)
Iteration 8:  Log likelihood = -700.79119  (not concave)
Iteration 9:  Log likelihood = -662.09093  
Iteration 10: Log likelihood = -627.58037  
Iteration 11: Log likelihood = -625.77581  
Iteration 12: Log likelihood = -625.76678  
Iteration 13: Log likelihood = -625.76678  

                                                           Number of obs = 540
                                                           Wald chi2(0)  =   .
Log likelihood = -625.76678                                Prob > chi2   =   .

 ( 1)  [hosp_s]tot_pop = 1
 ( 2)  [ucc_s]tot_pop2 = 1
--------------------------------------------------------------------------------
               | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
hosp_s         |
       tot_pop |          1  (constrained)
---------------+----------------------------------------------------------------
hosp_v         |
         rural |   87.57644   49.61804     1.77   0.078     -9.67312     184.826
     income_pc |  -1.313911   12.16017    -0.11   0.914    -25.14741    22.51959
      hispanic |  -101.8666   46.61447    -2.19   0.029    -193.2293   -10.50391
 nonhisp_black |   1069.314   448.0446     2.39   0.017     191.1632    1947.466
gte_highschool |  -161.3549    233.619    -0.69   0.490    -619.2396    296.5299
        age_65 |   723.6959   238.0644     3.04   0.002     257.0983    1190.294
     uninsured |   169.8809   176.3279     0.96   0.335    -175.7155    515.4773
---------------+----------------------------------------------------------------
hosp_f         |
cms_wage_index |   .9713967   .6308476     1.54   0.124    -.2650418    2.207835
 con_intensity |   .7807761   .2621087     2.98   0.003     .2670525      1.2945
---------------+----------------------------------------------------------------
      /hosp_a1 |   77.26963   94.60647     0.82   0.414    -108.1556    262.6949
      /hosp_g1 |   .4419044   .6071877     0.73   0.467    -.7481616     1.63197
---------------+----------------------------------------------------------------
ucc_s          |
      tot_pop2 |          1  (constrained)
---------------+----------------------------------------------------------------
ucc_v          |
   n_hospitals |  -75.07655   21.65542    -3.47   0.001    -117.5204    -32.6327
         rural |   69.02695   47.76644     1.45   0.148    -24.59356    162.6475
     income_pc |   .7983108     21.869     0.04   0.971    -42.06415    43.66077
      hispanic |  -78.31025   61.26329    -1.28   0.201    -198.3841    41.76359
 nonhisp_black |  -640.1481     441.07    -1.45   0.147    -1504.629    224.3333
gte_highschool |   262.1371   287.1499     0.91   0.361    -300.6663    824.9405
        age_65 |   286.1825   259.1425     1.10   0.269    -221.7274    794.0924
     uninsured |   263.2365   214.8332     1.23   0.220    -157.8288    684.3018
---------------+----------------------------------------------------------------
ucc_f          |
cms_wage_index |   .2642326   .5213589     0.51   0.612    -.7576122    1.286077
---------------+----------------------------------------------------------------
       /ucc_a1 |   318.8028    120.627     2.64   0.008     82.37822    555.2274
       /ucc_a2 |   266.9111    43.3664     6.15   0.000     181.9145    351.9077
       /ucc_a3 |  -6.771359   11.55497    -0.59   0.558    -29.41868    15.87596
       /ucc_g1 |   1.318727   .5133352     2.57   0.010     .3126088    2.324846
       /ucc_g2 |  -.0369043   .1177238    -0.31   0.754    -.2676388    .1938302
       /ucc_g3 |   .5745283    .113965     5.04   0.000     .3511609    .7978956
            /r |   .3934156   .1271836     3.09   0.002     .1441404    .6426909
--------------------------------------------------------------------------------
(est1 stored)

. qui do "BR_EntryThreshold_Bi.do" 10000 10000 "A"

. 
. // Exclude NY and NC
. 
. use "PCSALevelData_v3.dta", clear

. drop if inlist(state, "36", "37")
(26 observations deleted)

. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2)

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood = -1558.5474
Rescale:      Log likelihood = -1264.4109
Rescale eq:   Log likelihood = -802.11682
Iteration 0:  Log likelihood = -1607.2122  (not concave)
Iteration 1:  Log likelihood =  -1147.322  (not concave)
Iteration 2:  Log likelihood =  -948.9132  (not concave)
Iteration 3:  Log likelihood = -820.41823  
Iteration 4:  Log likelihood = -749.50414  
Iteration 5:  Log likelihood = -745.43839  
Iteration 6:  Log likelihood = -745.40616  
Iteration 7:  Log likelihood = -745.40615  

                                                           Number of obs = 647
                                                           Wald chi2(0)  =   .
Log likelihood = -745.40615                                Prob > chi2   =   .

 ( 1)  [hosp_s]tot_pop = 1
 ( 2)  [ucc_s]tot_pop2 = 1
--------------------------------------------------------------------------------
               | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
hosp_s         |
       tot_pop |          1  (constrained)
---------------+----------------------------------------------------------------
hosp_v         |
         rural |   102.8507   48.97694     2.10   0.036     6.857658    198.8437
     income_pc |   -3.74958   9.951046    -0.38   0.706    -23.25327    15.75411
      hispanic |  -129.2985   35.20582    -3.67   0.000    -198.3006   -60.29632
 nonhisp_black |   452.0466   244.0163     1.85   0.064    -26.21659    930.3097
gte_highschool |   -163.913   165.8269    -0.99   0.323    -488.9277    161.1017
        age_65 |   363.4088   165.8593     2.19   0.028     38.33047    688.4871
     uninsured |   144.9104   162.9787     0.89   0.374    -174.5219    464.3428
---------------+----------------------------------------------------------------
hosp_f         |
cms_wage_index |   .9043315   .5608629     1.61   0.107    -.1949396    2.003603
 con_intensity |   .5664597   .2638649     2.15   0.032      .049294    1.083625
---------------+----------------------------------------------------------------
      /hosp_a1 |   148.7902   69.28685     2.15   0.032     12.99044    284.5899
      /hosp_g1 |   .5459715    .547776     1.00   0.319    -.5276497    1.619593
---------------+----------------------------------------------------------------
ucc_s          |
      tot_pop2 |          1  (constrained)
---------------+----------------------------------------------------------------
ucc_v          |
   n_hospitals |  -59.40029   21.26284    -2.79   0.005    -101.0747   -17.72589
         rural |   64.86109   45.14018     1.44   0.151    -23.61205    153.3342
     income_pc |  -3.398795   17.70322    -0.19   0.848    -38.09648    31.29889
      hispanic |  -31.85715   54.72479    -0.58   0.560    -139.1158    75.40147
 nonhisp_black |  -236.2919   244.9324    -0.96   0.335    -716.3506    243.7668
gte_highschool |   227.8978   255.9596     0.89   0.373    -273.7739    729.5694
        age_65 |   366.7915   200.1883     1.83   0.067    -25.57024    759.1533
     uninsured |   64.43779   205.2257     0.31   0.754    -337.7972    466.6728
---------------+----------------------------------------------------------------
ucc_f          |
cms_wage_index |    .493594   .4724835     1.04   0.296    -.4324567    1.419645
---------------+----------------------------------------------------------------
       /ucc_a1 |   336.4511   112.2476     3.00   0.003     116.4499    556.4523
       /ucc_a2 |   263.1851   39.57217     6.65   0.000     185.6251    340.7451
       /ucc_a3 |  -3.104764    11.8453    -0.26   0.793    -26.32112    20.11159
       /ucc_g1 |   1.098687   .4684722     2.35   0.019      .180498    2.016875
       /ucc_g2 |   .0353953   .1073218     0.33   0.742    -.1749516    .2457422
       /ucc_g3 |   .5465464   .1100249     4.97   0.000     .3309015    .7621912
            /r |   .2901559   .1174512     2.47   0.013     .0599559    .5203559
--------------------------------------------------------------------------------
(est2 stored)

. qui do "BR_EntryThreshold_Bi.do" 10000 10000 "B"

. 
. estout *, drop(tot_pop*) cells(b se) label mlabels("UCC regulation" "NY and NC")

----------------------------------------------
                     UCC regula~n    NY and NC
                             b/se         b/se
----------------------------------------------
hosp_v                                        
Rural                    87.57644     102.8507
                         49.61804     48.97694
Income per capita       -1.313911     -3.74958
                         12.16017     9.951046
Hispanic                -101.8666    -129.2985
                         46.61447     35.20582
Black                    1069.314     452.0466
                         448.0446     244.0163
High school or more     -161.3549     -163.913
                          233.619     165.8269
Age 65 or more           723.6959     363.4088
                         238.0644     165.8593
Uninsured                169.8809     144.9104
                         176.3279     162.9787
----------------------------------------------
hosp_f                                        
CMS wage index           .9713967     .9043315
                         .6308476     .5608629
CON laws                 .7807761     .5664597
                         .2621087     .2638649
----------------------------------------------
/                                             
hosp_a1                  77.26963     148.7902
                         94.60647     69.28685
hosp_g1                  .4419044     .5459715
                         .6071877      .547776
----------------------------------------------
ucc_v                                         
Additional hospita~e    -75.07655    -59.40029
                         21.65542     21.26284
Rural                    69.02695     64.86109
                         47.76644     45.14018
Income per capita        .7983108    -3.398795
                           21.869     17.70322
Hispanic                -78.31025    -31.85715
                         61.26329     54.72479
Black                   -640.1481    -236.2919
                           441.07     244.9324
High school or more      262.1371     227.8978
                         287.1499     255.9596
Age 65 or more           286.1825     366.7915
                         259.1425     200.1883
Uninsured                263.2365     64.43779
                         214.8332     205.2257
----------------------------------------------
ucc_f                                         
CMS wage index           .2642326      .493594
                         .5213589     .4724835
----------------------------------------------
/                                             
ucc_a1                   318.8028     336.4511
                          120.627     112.2476
ucc_a2                   266.9111     263.1851
                          43.3664     39.57217
ucc_a3                  -6.771359    -3.104764
                         11.55497      11.8453
ucc_g1                   1.318727     1.098687
                         .5133352     .4684722
ucc_g2                  -.0369043     .0353953
                         .1177238     .1073218
ucc_g3                   .5745283     .5465464
                          .113965     .1100249
r                        .3934156     .2901559
                         .1271836     .1174512
----------------------------------------------

. 
. // Alternative years
. 
. forvalues y = 2014(2)2016{
  2. 
.         use "ZCTALevelRobust_`y'.dta", clear
  3.         collapse (sum) tot_pop n_urgentcare n_hospitals n_hospaffucc_geo n_hospaffucc_geo2 an
> y_emergency hisp black other white og_* (firstnm) state (max) ucc_regulation, by(pcsa)
  4.         tempfile base 
  5.         save `base'
  6. 
.         use "ZCTALevelProcessed_R2_input.dta", clear
  7.         collapse (mean) rural income_pc cms_wage_index median_value median_gross_rent con_int
> ensity pop_growth rpl_themes [w=tot_pop], by(pcsa)
  8.         merge 1:1 pcsa using `base', nogen
  9.         save "PCSALevelData_Raw_`y'.dta", replace 
 10. 
.         use "PCSALevelData_Raw_`y'.dta", clear
 11.         merge 1:1 pcsa using "market_definition.dta", keep(3) nogen
 12.         gen le_highschool = og_less_highschool + og_highschool
 13.         gen gte_highschool = og_highschool + og_some_college + og_bachelor
 14.         gen female = og_female 
 15.         gen age_65 = og_age_65 
 16.         gen uninsured = og_uninsured
 17.         ren hisp hispanic 
 18.         ren black nonhisp_black 
 19.         ren other nonhisp_other
 20.         ren white nonhisp_white
 21.         replace tot_pop = tot_pop*10000*1000
 22.         local vars "hispanic nonhisp_white nonhisp_black nonhisp_other female age_65 uninsure
> d le_highschool gte_highschool"
 23.         foreach v of local vars{
 24.                  replace `v' = `v'/tot_pop
 25.         }
 26.         replace tot_pop = tot_pop/10000/1000
 27.         drop if income_pc==.
 28. 
.         gen cat_ucc = n_urgentcare
 29.         replace cat_ucc = 3 if cat_ucc>3
 30.         gen cat_hosp = n_hospitals
 31.         replace cat_hosp = 1 if cat_hosp>1
 32.         gen cat_hosp2 = n_hospitals
 33.         replace cat_hosp2 = 0 if cat_hosp2<=1
 34.         replace cat_hosp2 = 1 if cat_hosp2>=2
 35.         gen cat_aucc = n_hospaffucc_geo
 36.         replace cat_aucc = 1 if cat_aucc>1
 37.         gen n_ucc_aucc = n_urgentcare + n_hospaffucc_geo
 38.         gen cat_both = n_ucc_aucc
 39.         replace cat_both = 4 if cat_both>4
 40.         gen tot_pop2 = tot_pop
 41.         gen tot_pop3 = tot_pop
 42.         gen any_hosp = (n_hospitals>0)
 43.         gen any_aucc = (n_hospaffucc_geo>0)
 44.         gen any_ucc = (n_urgentcare>0) 
 45. 
.         gen median_income_pc = .
 46.         qui sum income_pc, detail
 47.         replace median_income_pc = r(p50)
 48.         gen high_income = (income_pc>=median_income_pc)
 49.         drop median_income_pc
 50. 
.         gen median_svi = .
 51.         qui sum rpl_themes, detail
 52.         replace median_svi = r(p50)
 53.         gen high_svi = (rpl_themes>=median_svi)
 54.         drop median_svi
 55. 
.         gen median_uninsured = .
 56.         qui sum uninsured, detail
 57.         replace median_uninsured = r(p50)
 58.         gen high_uninsured = (uninsured>=median_uninsured)
 59.         drop median_uninsured
 60. 
.         ren n_hospitals og_n_hospitals
 61.         gen n_hospitals = og_n_hospitals
 62.         replace n_hospitals = cat_hosp2
 63. 
.         ren n_hospaffucc_geo og_n_hospaffucc_geo
 64.         gen n_hospaffucc_geo = og_n_hospaffucc_geo
 65.         replace n_hospaffucc_geo = cat_aucc
 66. 
.         ren n_urgentcare og_n_urgentcare 
 67.         gen n_urgentcare = og_n_urgentcare
 68.         replace n_urgentcare = cat_ucc
 69. 
.         label var rural "Rural"
 70.         label var n_hospitals "Additional hospital presence"
 71.         label var income_pc "Income per capita"
 72.         label var hispanic "Hispanic"
 73.         label var nonhisp_white "White"
 74.         label var nonhisp_black "Black"
 75.         label var gte_highschool "High school or more"
 76.         label var age_65 "Age 65 or more"
 77.         label var uninsured "Uninsured"
 78.         label var n_urgentcare "Number of UCCs"
 79.         label var n_hospaffucc_geo "Number of AUCCs"
 80.         label var cms_wage_index "CMS wage index"
 81.         label var con_intensity "CON laws" 
 82. 
.         save "PCSALevelData_v3_`y'.dta", replace 
 83. 
. }
file C:\Users\nserna\AppData\Local\Temp\ST_99c8_000001.tmp saved as .dta format
(analytic weights assumed)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                             6,697  
    -----------------------------------------
(file PCSALevelData_Raw_2014.dta not found)
file PCSALevelData_Raw_2014.dta saved

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               673  
    -----------------------------------------
(673 real changes made)
(673 real changes made)
(650 real changes made)
(656 real changes made)
(672 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(0 observations deleted)
(174 real changes made)
(228 real changes made)
(374 real changes made)
(228 real changes made)
(151 real changes made)
(194 real changes made)
(673 missing values generated)
(673 real changes made)
(673 missing values generated)
(673 real changes made)
(673 missing values generated)
(673 real changes made)
(602 real changes made)
(151 real changes made)
(174 real changes made)
(file PCSALevelData_v3_2014.dta not found)
file PCSALevelData_v3_2014.dta saved
file C:\Users\nserna\AppData\Local\Temp\ST_99c8_000002.tmp saved as .dta format
(analytic weights assumed)

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                             6,697  
    -----------------------------------------
(file PCSALevelData_Raw_2016.dta not found)
file PCSALevelData_Raw_2016.dta saved

    Result                      Number of obs
    -----------------------------------------
    Not matched                             0
    Matched                               673  
    -----------------------------------------
(673 real changes made)
(673 real changes made)
(650 real changes made)
(656 real changes made)
(672 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(673 real changes made)
(0 observations deleted)
(176 real changes made)
(223 real changes made)
(395 real changes made)
(223 real changes made)
(149 real changes made)
(200 real changes made)
(673 missing values generated)
(673 real changes made)
(673 missing values generated)
(673 real changes made)
(673 missing values generated)
(673 real changes made)
(618 real changes made)
(149 real changes made)
(176 real changes made)
(file PCSALevelData_v3_2016.dta not found)
file PCSALevelData_v3_2016.dta saved

. 
. use "PCSALevelData_v3_2014.dta", clear

. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2)

. eststo clear

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood = -1626.7024
Rescale:      Log likelihood = -1298.0211
Rescale eq:   Log likelihood = -892.29318
Iteration 0:  Log likelihood = -1530.1787  (not concave)
Iteration 1:  Log likelihood = -1211.3373  (not concave)
Iteration 2:  Log likelihood = -1135.3489  (not concave)
Iteration 3:  Log likelihood = -1081.5002  (not concave)
Iteration 4:  Log likelihood = -1007.2918  (not concave)
Iteration 5:  Log likelihood = -981.02777  (not concave)
Iteration 6:  Log likelihood = -959.46098  (not concave)
Iteration 7:  Log likelihood = -959.23215  (not concave)
Iteration 8:  Log likelihood = -959.23183  (not concave)
Iteration 9:  Log likelihood = -959.23183  (not concave)
Iteration 10: Log likelihood = -959.23167  (not concave)
Iteration 11: Log likelihood = -959.23167  (not concave)
Iteration 12: Log likelihood = -959.23167  (not concave)
Iteration 13: Log likelihood = -959.23167  (not concave)
Iteration 14: Log likelihood = -959.23167  (not concave)
Iteration 15: Log likelihood = -959.23167  (not concave)
Iteration 16: Log likelihood = -959.23167  (not concave)
Iteration 17: Log likelihood = -959.23167  (not concave)
Iteration 18: Log likelihood = -959.23167  (not concave)
Iteration 19: Log likelihood = -959.23167  (not concave)
Iteration 20: Log likelihood = -959.23167  (not concave)
Iteration 21: Log likelihood = -959.23167  (not concave)
Iteration 22: Log likelihood = -959.23167  (not concave)
Iteration 23: Log likelihood = -959.23167  (not concave)
Iteration 24: Log likelihood = -959.23167  (not concave)
Iteration 25: Log likelihood = -959.23167  (not concave)
Iteration 26: Log likelihood = -959.23167  (not concave)
Iteration 27: Log likelihood = -959.23167  (not concave)
Iteration 28: Log likelihood = -959.23167  (not concave)
Iteration 29: Log likelihood = -959.23167  (not concave)
Iteration 30: Log likelihood = -959.23167  (not concave)
Iteration 31: Log likelihood = -959.23167  (not concave)
Iteration 32: Log likelihood = -959.23167  (not concave)
Iteration 33: Log likelihood = -959.23167  (not concave)
Iteration 34: Log likelihood = -959.23167  (not concave)
Iteration 35: Log likelihood = -959.23167  (not concave)
Iteration 36: Log likelihood = -959.23167  (not concave)
Iteration 37: Log likelihood = -959.23167  (not concave)
Iteration 38: Log likelihood = -959.23167  (not concave)
Iteration 39: Log likelihood = -959.23167  (not concave)
Iteration 40: Log likelihood = -959.23167  (not concave)
Iteration 41: Log likelihood = -959.23167  (not concave)
Iteration 42: Log likelihood = -959.23167  (not concave)
Iteration 43: Log likelihood = -959.23167  (not concave)
Iteration 44: Log likelihood = -959.23167  (not concave)
Iteration 45: Log likelihood = -959.23167  (not concave)
Iteration 46: Log likelihood = -959.23167  (not concave)
Iteration 47: Log likelihood = -959.23167  (not concave)
Iteration 48: Log likelihood = -959.23167  (not concave)
Iteration 49: Log likelihood = -959.23167  (not concave)
Iteration 50: Log likelihood = -959.23167  (not concave)
Iteration 51: Log likelihood = -959.23167  (not concave)
Iteration 52: Log likelihood = -959.23167  (not concave)
Iteration 53: Log likelihood = -959.23167  (not concave)
Iteration 54: Log likelihood = -959.23167  (not concave)
Iteration 55: Log likelihood = -959.23167  (not concave)
Iteration 56: Log likelihood = -959.23167  (not concave)
Iteration 57: Log likelihood = -959.23167  (not concave)
Iteration 58: Log likelihood = -959.23167  (not concave)
Iteration 59: Log likelihood = -959.23167  (not concave)
Iteration 60: Log likelihood = -959.23167  (not concave)
Iteration 61: Log likelihood = -959.23167  (not concave)
Iteration 62: Log likelihood = -959.23167  (not concave)
Iteration 63: Log likelihood = -959.23167  (not concave)
Iteration 64: Log likelihood = -959.23167  (not concave)
Iteration 65: Log likelihood = -959.23167  (not concave)
Iteration 66: Log likelihood = -959.23167  (not concave)
Iteration 67: Log likelihood = -959.23167  (not concave)
Iteration 68: Log likelihood = -959.23167  (not concave)
Iteration 69: Log likelihood = -959.23167  (not concave)
Iteration 70: Log likelihood = -959.23167  (not concave)
Iteration 71: Log likelihood = -959.23167  (not concave)
Iteration 72: Log likelihood = -959.23167  (not concave)
Iteration 73: Log likelihood = -959.23167  (not concave)
Iteration 74: Log likelihood = -959.23167  (not concave)
Iteration 75: Log likelihood = -959.23167  (not concave)
Iteration 76: Log likelihood = -959.23167  (not concave)
Iteration 77: Log likelihood = -959.23167  (not concave)
Iteration 78: Log likelihood = -959.23167  (not concave)
Iteration 79: Log likelihood = -959.23167  (not concave)
Iteration 80: Log likelihood = -959.23167  (not concave)
Iteration 81: Log likelihood = -959.23167  (not concave)
Iteration 82: Log likelihood = -959.23167  (not concave)
Iteration 83: Log likelihood = -959.23167  (not concave)
Iteration 84: Log likelihood = -959.23167  (not concave)
Iteration 85: Log likelihood = -959.23167  (not concave)
Iteration 86: Log likelihood = -959.23167  (not concave)
Iteration 87: Log likelihood = -959.23167  (not concave)
Iteration 88: Log likelihood = -959.23167  (not concave)
Iteration 89: Log likelihood = -959.23167  (not concave)
Iteration 90: Log likelihood = -959.23167  (not concave)
Iteration 91: Log likelihood = -959.23167  (not concave)
Iteration 92: Log likelihood = -959.23167  (not concave)
Iteration 93: Log likelihood = -959.23167  (not concave)
Iteration 94: Log likelihood = -959.23167  (not concave)
Iteration 95: Log likelihood = -959.23167  (not concave)
Iteration 96: Log likelihood = -959.23167  (not concave)
Iteration 97: Log likelihood = -959.23167  (not concave)
Iteration 98: Log likelihood = -959.23167  (not concave)
Iteration 99: Log likelihood = -959.23167  (not concave)
Iteration 100: Log likelihood = -959.23167  (not concave)
Iteration 101: Log likelihood = -959.23167  (not concave)
Iteration 102: Log likelihood = -959.23167  (not concave)
Iteration 103: Log likelihood = -959.23167  (not concave)
Iteration 104: Log likelihood = -959.23167  (not concave)
Iteration 105: Log likelihood = -959.23167  (not concave)
Iteration 106: Log likelihood = -959.23167  (not concave)
Iteration 107: Log likelihood = -959.23167  (not concave)
Iteration 108: Log likelihood = -959.23167  (not concave)
Iteration 109: Log likelihood = -959.23167  (not concave)
Iteration 110: Log likelihood = -959.23167  (not concave)
Iteration 111: Log likelihood = -959.23167  (not concave)
Iteration 112: Log likelihood = -959.23167  (not concave)
Iteration 113: Log likelihood = -959.23167  (not concave)
Iteration 114: Log likelihood = -959.23167  (not concave)
Iteration 115: Log likelihood = -959.23167  (not concave)
Iteration 116: Log likelihood = -959.23167  (not concave)
Iteration 117: Log likelihood = -959.23167  (not concave)
Iteration 118: Log likelihood = -959.23167  (not concave)
Iteration 119: Log likelihood = -959.23167  (not concave)
Iteration 120: Log likelihood = -959.23167  (not concave)
Iteration 121: Log likelihood = -959.23167  (not concave)
Iteration 122: Log likelihood = -959.23167  (not concave)
Iteration 123: Log likelihood = -959.23167  (not concave)
Iteration 124: Log likelihood = -959.23167  (not concave)
Iteration 125: Log likelihood = -959.23167  (not concave)
Iteration 126: Log likelihood = -959.23167  (not concave)
Iteration 127: Log likelihood = -959.23167  (not concave)
Iteration 128: Log likelihood = -959.23167  (not concave)
Iteration 129: Log likelihood = -959.23167  (not concave)
Iteration 130: Log likelihood = -959.23167  (not concave)
Iteration 131: Log likelihood = -959.23167  (not concave)
Iteration 132: Log likelihood = -959.23167  (not concave)
Iteration 133: Log likelihood = -959.23167  (not concave)
Iteration 134: Log likelihood = -959.23167  (not concave)
Iteration 135: Log likelihood = -959.23167  (not concave)
Iteration 136: Log likelihood = -959.23167  (not concave)
Iteration 137: Log likelihood = -959.23167  (not concave)
Iteration 138: Log likelihood = -959.23167  (not concave)
Iteration 139: Log likelihood = -959.23167  (not concave)
Iteration 140: Log likelihood = -959.23167  (not concave)
Iteration 141: Log likelihood = -959.23167  (not concave)
Iteration 142: Log likelihood = -959.23167  (not concave)
Iteration 143: Log likelihood = -959.23167  (not concave)
Iteration 144: Log likelihood = -959.23167  (not concave)
Iteration 145: Log likelihood = -959.23167  (not concave)
Iteration 146: Log likelihood = -959.23167  (not concave)
Iteration 147: Log likelihood = -959.23167  (not concave)
Iteration 148: Log likelihood = -959.23167  (not concave)
Iteration 149: Log likelihood = -959.23167  (not concave)
Iteration 150: Log likelihood = -959.23167  (not concave)
Iteration 151: Log likelihood = -959.23167  (not concave)
Iteration 152: Log likelihood = -959.23167  (not concave)
Iteration 153: Log likelihood = -959.23167  (not concave)
Iteration 154: Log likelihood = -959.23167  (not concave)
Iteration 155: Log likelihood = -959.23167  (not concave)
Iteration 156: Log likelihood = -959.23167  (not concave)
Iteration 157: Log likelihood = -959.23167  (not concave)
Iteration 158: Log likelihood = -959.23167  (not concave)
Iteration 159: Log likelihood = -959.23167  (not concave)
Iteration 160: Log likelihood = -959.23167  (not concave)
Iteration 161: Log likelihood = -959.23167  (not concave)
Iteration 162: Log likelihood = -959.23167  (not concave)
Iteration 163: Log likelihood = -959.23167  (not concave)
Iteration 164: Log likelihood = -959.23167  (not concave)
Iteration 165: Log likelihood = -959.23167  (not concave)
Iteration 166: Log likelihood = -959.23167  (not concave)
Iteration 167: Log likelihood = -959.23167  (not concave)
Iteration 168: Log likelihood = -959.23167  (not concave)
Iteration 169: Log likelihood = -959.23167  (not concave)
Iteration 170: Log likelihood = -959.23167  (not concave)
Iteration 171: Log likelihood = -959.23167  (not concave)
Iteration 172: Log likelihood = -959.23167  (not concave)
Iteration 173: Log likelihood = -959.23167  (not concave)
Iteration 174: Log likelihood = -959.23167  (not concave)
Iteration 175: Log likelihood = -959.23167  (not concave)
Iteration 176: Log likelihood = -959.23167  (not concave)
Iteration 177: Log likelihood = -959.23167  (not concave)
Iteration 178: Log likelihood = -959.23167  (not concave)
Iteration 179: Log likelihood = -959.23167  (not concave)
Iteration 180: Log likelihood = -959.23167  (not concave)
Iteration 181: Log likelihood = -959.23167  (not concave)
Iteration 182: Log likelihood = -959.23167  (not concave)
Iteration 183: Log likelihood = -959.23167  (not concave)
Iteration 184: Log likelihood = -959.23167  (not concave)
Iteration 185: Log likelihood = -959.23167  (not concave)
Iteration 186: Log likelihood = -959.23167  (not concave)
Iteration 187: Log likelihood = -959.23167  (not concave)
Iteration 188: Log likelihood = -959.23167  (not concave)
Iteration 189: Log likelihood = -959.23167  (not concave)
Iteration 190: Log likelihood = -959.23167  (not concave)
Iteration 191: Log likelihood = -959.23167  (not concave)
Iteration 192: Log likelihood = -959.23167  (not concave)
Iteration 193: Log likelihood = -959.23167  (not concave)
Iteration 194: Log likelihood = -959.23167  (not concave)
Iteration 195: Log likelihood = -959.23167  (not concave)
Iteration 196: Log likelihood = -959.23167  (not concave)
Iteration 197: Log likelihood = -959.23167  (not concave)
Iteration 198: Log likelihood = -959.23167  (not concave)
Iteration 199: Log likelihood = -959.23167  (not concave)
Iteration 200: Log likelihood = -959.23167  (not concave)
convergence not achieved

                                                           Number of obs = 673
                                                           Wald chi2(0)  =   .
Log likelihood = -959.23167                                Prob > chi2   =   .

 ( 1)  [hosp_s]tot_pop = 1
 ( 2)  [ucc_s]tot_pop2 = 1
--------------------------------------------------------------------------------
               | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
hosp_s         |
       tot_pop |          1  (constrained)
---------------+----------------------------------------------------------------
hosp_v         |
         rural |  -36.82936          .        .       .            .           .
     income_pc |  -57.78297   3.51e-08 -1.6e+09   0.000    -57.78297   -57.78297
      hispanic |   -107.955   2.18e-07 -5.0e+08   0.000     -107.955    -107.955
 nonhisp_black |   5.814837   2.87e-06  2.0e+06   0.000     5.814832    5.814843
gte_highschool |   195.7389   2.88e-07  6.8e+08   0.000     195.7389    195.7389
        age_65 |   88.17776          .        .       .            .           .
     uninsured |   69.53424          .        .       .            .           .
---------------+----------------------------------------------------------------
hosp_f         |
cms_wage_index |   3.152745   1.43e-09  2.2e+09   0.000     3.152745    3.152745
 con_intensity |   .5736854   3.03e-09  1.9e+08   0.000     .5736854    .5736854
---------------+----------------------------------------------------------------
      /hosp_a1 |   182.9126          .        .       .            .           .
      /hosp_g1 |  -1.933696   6.43e-13 -3.0e+12   0.000    -1.933696   -1.933696
---------------+----------------------------------------------------------------
ucc_s          |
      tot_pop2 |          1  (constrained)
---------------+----------------------------------------------------------------
ucc_v          |
   n_hospitals |  -3.196358          .        .       .            .           .
         rural |   37.93509          .        .       .            .           .
     income_pc |  -1.914464   3.56e-08 -5.4e+07   0.000    -1.914464   -1.914464
      hispanic |  -177.6218          .        .       .            .           .
 nonhisp_black |   .3364619          .        .       .            .           .
gte_highschool |   253.3484          .        .       .            .           .
        age_65 |   89.63322          .        .       .            .           .
     uninsured |   78.05814          .        .       .            .           .
---------------+----------------------------------------------------------------
ucc_f          |
cms_wage_index |   1.745785          .        .       .            .           .
---------------+----------------------------------------------------------------
       /ucc_a1 |   88.29094          .        .       .            .           .
       /ucc_a2 |   32.37943   10.57602     3.06   0.002     11.65082    53.10804
       /ucc_a3 |  -25.43795   11.35917    -2.24   0.025    -47.70152   -3.174378
       /ucc_g1 |  -.8757452          .        .       .            .           .
       /ucc_g2 |   .4159484   .0750749     5.54   0.000     .2688043    .5630925
       /ucc_g3 |   .6803919   .1087006     6.26   0.000     .4673427    .8934411
            /r |  -.3314347   1.72e-14 -1.9e+13   0.000    -.3314347   -.3314347
--------------------------------------------------------------------------------
Warning: Convergence not achieved.
(est1 stored)

. qui do "BR_EntryThreshold_Bi.do" 10000 10000 "C"

. 
. use "PCSALevelData_v3_2016.dta", clear

. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2) technique(bfgs)

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood = -1664.1099
Rescale:      Log likelihood =  -1336.362
Rescale eq:   Log likelihood = -814.09191
Iteration 0:  Log likelihood = -2078.0858  
Iteration 1:  Log likelihood = -1443.6436  (backed up)
Iteration 2:  Log likelihood = -1287.4671  (backed up)
Iteration 3:  Log likelihood = -1281.3862  (backed up)
Iteration 4:  Log likelihood = -1279.0614  (backed up)
Iteration 5:  Log likelihood = -1270.4894  (backed up)
Iteration 6:  Log likelihood = -1209.7274  (backed up)
Iteration 7:  Log likelihood = -974.86365  
Iteration 8:  Log likelihood = -964.70392  
Iteration 9:  Log likelihood = -881.36139  
Iteration 10: Log likelihood = -869.36347  
Iteration 11: Log likelihood = -861.40298  
Iteration 12: Log likelihood =  -854.0394  
Iteration 13: Log likelihood = -851.40401  
Iteration 14: Log likelihood = -849.62916  
Iteration 15: Log likelihood = -848.76919  
Iteration 16: Log likelihood =  -846.6863  
Iteration 17: Log likelihood = -834.97558  
Iteration 18: Log likelihood = -825.87355  
Iteration 19: Log likelihood = -821.79425  
Iteration 20: Log likelihood = -818.05703  
Iteration 21: Log likelihood = -817.39913  
Iteration 22: Log likelihood = -817.19691  
Iteration 23: Log likelihood = -816.72338  
Iteration 24: Log likelihood = -811.65932  
Iteration 25: Log likelihood =  -798.9878  
Iteration 26: Log likelihood = -794.35769  
Iteration 27: Log likelihood = -793.72031  
Iteration 28: Log likelihood = -793.64289  
Iteration 29: Log likelihood = -793.48052  
Iteration 30: Log likelihood = -792.03021  
Iteration 31: Log likelihood = -789.72446  
Iteration 32: Log likelihood = -789.15548  
Iteration 33: Log likelihood = -789.12243  
Iteration 34: Log likelihood = -788.98019  
Iteration 35: Log likelihood = -787.26036  
Iteration 36: Log likelihood = -783.63129  
Iteration 37: Log likelihood = -782.99922  
Iteration 38: Log likelihood = -782.98908  
Iteration 39: Log likelihood = -782.91484  
Iteration 40: Log likelihood = -781.59147  
Iteration 41: Log likelihood = -779.92602  
Iteration 42: Log likelihood = -779.77818  
Iteration 43: Log likelihood = -779.77152  
Iteration 44: Log likelihood = -779.75324  
Iteration 45: Log likelihood =  -779.1747  
Iteration 46: Log likelihood = -778.28986  
Iteration 47: Log likelihood = -778.24295  
Iteration 48: Log likelihood = -778.24114  
Iteration 49: Log likelihood = -778.23318  
Iteration 50: Log likelihood = -778.08971  
Iteration 51: Log likelihood = -777.98521  
Iteration 52: Log likelihood = -777.98037  
Iteration 53: Log likelihood =   -777.979  
Iteration 54: Log likelihood = -777.96845  
Iteration 55: Log likelihood = -777.23769  
Iteration 56: Log likelihood = -776.95366  
Iteration 57: Log likelihood = -776.94544  
Iteration 58: Log likelihood = -776.94186  
Iteration 59: Log likelihood = -776.82373  
Iteration 60: Log likelihood = -775.72402  
Iteration 61: Log likelihood = -775.21474  
Iteration 62: Log likelihood = -775.20702  
Iteration 63: Log likelihood = -775.20662  
Iteration 64: Log likelihood = -775.20526  
Iteration 65: Log likelihood = -775.14935  
Iteration 66: Log likelihood = -775.06159  
Iteration 67: Log likelihood = -775.05059  
Iteration 68: Log likelihood = -775.05052  
Iteration 69: Log likelihood = -775.04758  
Iteration 70: Log likelihood = -774.92204  
Iteration 71: Log likelihood = -774.63984  
Iteration 72: Log likelihood = -774.58584  
Iteration 73: Log likelihood =  -774.5851  
Iteration 74: Log likelihood = -774.58509  
Iteration 75: Log likelihood = -774.58503  
Iteration 76: Log likelihood = -774.58406  
Iteration 77: Log likelihood = -774.56399  
Iteration 78: Log likelihood = -774.55222  
Iteration 79: Log likelihood = -774.55189  
Iteration 80: Log likelihood = -774.55189  
Iteration 81: Log likelihood = -774.55155  
Iteration 82: Log likelihood = -774.54408  
Iteration 83: Log likelihood = -774.54256  
Iteration 84: Log likelihood = -774.54255  
Iteration 85: Log likelihood = -774.54255  
Iteration 86: Log likelihood = -774.54254  
Iteration 87: Log likelihood = -774.54242  
Iteration 88: Log likelihood = -774.54186  
Iteration 89: Log likelihood = -774.54152  
Iteration 90: Log likelihood = -774.54152  
Iteration 91: Log likelihood = -774.54152  
Iteration 92: Log likelihood = -774.54152  
Iteration 93: Log likelihood = -774.54151  
Iteration 94: Log likelihood = -774.54149  

                                                           Number of obs = 673
                                                           Wald chi2(0)  =   .
Log likelihood = -774.54149                                Prob > chi2   =   .

 ( 1)  [hosp_s]tot_pop = 1
 ( 2)  [ucc_s]tot_pop2 = 1
--------------------------------------------------------------------------------
               | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
hosp_s         |
       tot_pop |          1  (constrained)
---------------+----------------------------------------------------------------
hosp_v         |
         rural |   123.0201   45.05817     2.73   0.006     34.70771    211.3325
     income_pc |   1.233154   8.228265     0.15   0.881    -14.89395    17.36026
      hispanic |  -104.8432   27.44896    -3.82   0.000    -158.6422   -51.04425
 nonhisp_black |   485.4181   240.5343     2.02   0.044     13.97946    956.8567
gte_highschool |  -237.5013   141.9326    -1.67   0.094    -515.6841    40.68145
        age_65 |   175.1166   144.2003     1.21   0.225    -107.5107     457.744
     uninsured |   184.2608    146.407     1.26   0.208    -102.6916    471.2131
---------------+----------------------------------------------------------------
hosp_f         |
cms_wage_index |   .8727432   .5329843     1.64   0.102    -.1718869    1.917373
 con_intensity |   .8234538   .2545364     3.24   0.001     .3245717    1.322336
---------------+----------------------------------------------------------------
      /hosp_a1 |   166.8067   59.07061     2.82   0.005     51.03041    282.5829
      /hosp_g1 |   .4830143   .5210306     0.93   0.354    -.5381869    1.504216
---------------+----------------------------------------------------------------
ucc_s          |
      tot_pop2 |          1  (constrained)
---------------+----------------------------------------------------------------
ucc_v          |
   n_hospitals |  -35.39839   21.09947    -1.68   0.093    -76.75259    5.955817
         rural |   21.24376   43.87525     0.48   0.628    -64.75015    107.2377
     income_pc |   9.882633   20.50865     0.48   0.630    -30.31358    50.07885
      hispanic |   5.595367   57.27871     0.10   0.922    -106.6688    117.8596
 nonhisp_black |  -220.2855   247.0741    -0.89   0.373    -704.5418    263.9708
gte_highschool |   321.2325   277.9151     1.16   0.248    -223.4712    865.9361
        age_65 |   187.5436   196.1881     0.96   0.339     -196.978    572.0652
     uninsured |   60.31356    205.143     0.29   0.769    -341.7594    462.3866
---------------+----------------------------------------------------------------
ucc_f          |
cms_wage_index |   1.124663   .4863806     2.31   0.021     .1713742    2.077951
---------------+----------------------------------------------------------------
       /ucc_a1 |   314.6004   118.5718     2.65   0.008     82.20392    546.9968
       /ucc_a2 |   283.9422   43.70594     6.50   0.000     198.2801    369.6043
       /ucc_a3 |   34.51073   16.40942     2.10   0.035     2.348863    66.67259
       /ucc_g1 |   .5005248    .478686     1.05   0.296    -.4376824    1.438732
       /ucc_g2 |   .1096224   .1258536     0.87   0.384    -.1370461     .356291
       /ucc_g3 |   .3336218   .1223809     2.73   0.006     .0937596    .5734839
            /r |   .1890767    .118003     1.60   0.109    -.0422049    .4203584
--------------------------------------------------------------------------------
(est2 stored)

. qui do "BR_EntryThreshold_Bi.do" 10000 10000 "D"

. 
. estout *, drop(tot_pop*) cells(b se) label mlabels("2014" "2016")

----------------------------------------------
                             2014         2016
                             b/se         b/se
----------------------------------------------
hosp_v                                        
Rural                   -36.82936     123.0201
                                .     45.05817
Income per capita       -57.78297     1.233154
                         3.51e-08     8.228265
Hispanic                 -107.955    -104.8432
                         2.18e-07     27.44896
Black                    5.814837     485.4181
                         2.87e-06     240.5343
High school or more      195.7389    -237.5013
                         2.88e-07     141.9326
Age 65 or more           88.17776     175.1166
                                .     144.2003
Uninsured                69.53424     184.2608
                                .      146.407
----------------------------------------------
hosp_f                                        
CMS wage index           3.152745     .8727432
                         1.43e-09     .5329843
CON laws                 .5736854     .8234538
                         3.03e-09     .2545364
----------------------------------------------
/                                             
hosp_a1                  182.9126     166.8067
                                .     59.07061
hosp_g1                 -1.933696     .4830143
                         6.43e-13     .5210306
----------------------------------------------
ucc_v                                         
Additional hospita~e    -3.196358    -35.39839
                                .     21.09947
Rural                    37.93509     21.24376
                                .     43.87525
Income per capita       -1.914464     9.882633
                         3.56e-08     20.50865
Hispanic                -177.6218     5.595367
                                .     57.27871
Black                    .3364619    -220.2855
                                .     247.0741
High school or more      253.3484     321.2325
                                .     277.9151
Age 65 or more           89.63322     187.5436
                                .     196.1881
Uninsured                78.05814     60.31356
                                .      205.143
----------------------------------------------
ucc_f                                         
CMS wage index           1.745785     1.124663
                                .     .4863806
----------------------------------------------
/                                             
ucc_a1                   88.29094     314.6004
                                .     118.5718
ucc_a2                   32.37943     283.9422
                         10.57602     43.70594
ucc_a3                  -25.43795     34.51073
                         11.35917     16.40942
ucc_g1                  -.8757452     .5005248
                                .      .478686
ucc_g2                   .4159484     .1096224
                         .0750749     .1258536
ucc_g3                   .6803919     .3336218
                         .1087006     .1223809
r                       -.3314347     .1890767
                         1.72e-14      .118003
----------------------------------------------

. 
. // Drop hospitals without emergency care
. 
. use "PCSALevelData_v3.dta", clear

. replace cat_hosp2 = any_emergency
(578 real changes made)

. replace cat_hosp2 = 0 if cat_hosp2<=1
(395 real changes made)

. replace cat_hosp2 = 1 if cat_hosp2>=2
(209 real changes made)

. replace n_hospitals = cat_hosp2
(26 real changes made)

. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2)

. eststo clear

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood = -1652.7498
Rescale:      Log likelihood = -1322.0063
Rescale eq:   Log likelihood = -858.83222
Iteration 0:  Log likelihood = -1472.6679  (not concave)
Iteration 1:  Log likelihood = -1132.2507  (not concave)
Iteration 2:  Log likelihood = -1036.2412  (not concave)
Iteration 3:  Log likelihood = -985.55874  (not concave)
Iteration 4:  Log likelihood = -840.44201  (not concave)
Iteration 5:  Log likelihood = -835.61487  (not concave)
Iteration 6:  Log likelihood = -832.36609  (not concave)
Iteration 7:  Log likelihood = -829.26882  (not concave)
Iteration 8:  Log likelihood = -828.31478  (not concave)
Iteration 9:  Log likelihood = -821.17877  (not concave)
Iteration 10: Log likelihood = -816.89636  (not concave)
Iteration 11: Log likelihood = -815.68735  (not concave)
Iteration 12: Log likelihood = -802.02221  
Iteration 13: Log likelihood = -783.76685  
Iteration 14: Log likelihood =  -781.4205  
Iteration 15: Log likelihood = -781.39658  
Iteration 16: Log likelihood = -781.39655  

                                                           Number of obs = 673
                                                           Wald chi2(0)  =   .
Log likelihood = -781.39655                                Prob > chi2   =   .

 ( 1)  [hosp_s]tot_pop = 1
 ( 2)  [ucc_s]tot_pop2 = 1
--------------------------------------------------------------------------------
               | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
hosp_s         |
       tot_pop |          1  (constrained)
---------------+----------------------------------------------------------------
hosp_v         |
         rural |   141.6686   44.78008     3.16   0.002     53.90122    229.4359
     income_pc |   3.030214   7.963384     0.38   0.704    -12.57773    18.63816
      hispanic |  -96.14608   27.38935    -3.51   0.000    -149.8282   -42.46393
 nonhisp_black |   521.6371   240.1257     2.17   0.030     50.99931    992.2749
gte_highschool |  -260.1351   140.5775    -1.85   0.064    -535.6618    15.39172
        age_65 |   199.4752   141.9523     1.41   0.160    -78.74618    477.6966
     uninsured |   191.1704   145.3128     1.32   0.188    -93.63753    475.9783
---------------+----------------------------------------------------------------
hosp_f         |
cms_wage_index |   .7043598   .5365567     1.31   0.189    -.3472721    1.755992
 con_intensity |    .701235   .2509922     2.79   0.005     .2092993    1.193171
---------------+----------------------------------------------------------------
      /hosp_a1 |   163.0078   58.84829     2.77   0.006     47.66733    278.3484
      /hosp_g1 |   .7539283    .526053     1.43   0.152    -.2771166    1.784973
---------------+----------------------------------------------------------------
ucc_s          |
      tot_pop2 |          1  (constrained)
---------------+----------------------------------------------------------------
ucc_v          |
   n_hospitals |  -76.49163   19.37318    -3.95   0.000    -114.4624    -38.5209
         rural |   59.96027   42.83666     1.40   0.162    -23.99803    143.9186
     income_pc |  -32.60848   11.11674    -2.93   0.003    -54.39688   -10.82008
      hispanic |  -78.81228   48.24926    -1.63   0.102    -173.3791    15.75453
 nonhisp_black |  -226.1403   240.9646    -0.94   0.348    -698.4223    246.1416
gte_highschool |   308.5099   224.5858     1.37   0.170    -131.6702    748.6901
        age_65 |   254.9432   183.9085     1.39   0.166    -105.5108    615.3971
     uninsured |    128.023   184.3787     0.69   0.487    -233.3526    489.3985
---------------+----------------------------------------------------------------
ucc_f          |
cms_wage_index |   .2403718   .4515588     0.53   0.595    -.6446672    1.125411
---------------+----------------------------------------------------------------
       /ucc_a1 |   402.6476   102.3439     3.93   0.000     202.0572     603.238
       /ucc_a2 |   255.6422     39.291     6.51   0.000     178.6332    332.6511
       /ucc_a3 |   2.932201   9.899509     0.30   0.767    -16.47048    22.33488
       /ucc_g1 |   1.336287    .450169     2.97   0.003     .4539719    2.218602
       /ucc_g2 |   .0579929   .1092954     0.53   0.596    -.1562221    .2722079
       /ucc_g3 |   .5101683   .0969321     5.26   0.000     .3201849    .7001518
            /r |   .3194508   .1163353     2.75   0.006     .0914378    .5474638
--------------------------------------------------------------------------------
(est1 stored)

. qui do "BR_EntryThreshold_Bi.do" 10000 10000 "E"

. estout *, drop(tot_pop*) cells("b(fmt(1)) se(fmt(1))") label

----------------------------------------------
                             est1             
                                b           se
----------------------------------------------
hosp_v                                        
Rural                       141.7         44.8
Income per capita             3.0          8.0
Hispanic                    -96.1         27.4
Black                       521.6        240.1
High school or more        -260.1        140.6
Age 65 or more              199.5        142.0
Uninsured                   191.2        145.3
----------------------------------------------
hosp_f                                        
CMS wage index                0.7          0.5
CON laws                      0.7          0.3
----------------------------------------------
/                                             
hosp_a1                     163.0         58.8
hosp_g1                       0.8          0.5
----------------------------------------------
ucc_v                                         
Additional hospita~e        -76.5         19.4
Rural                        60.0         42.8
Income per capita           -32.6         11.1
Hispanic                    -78.8         48.2
Black                      -226.1        241.0
High school or more         308.5        224.6
Age 65 or more              254.9        183.9
Uninsured                   128.0        184.4
----------------------------------------------
ucc_f                                         
CMS wage index                0.2          0.5
----------------------------------------------
/                                             
ucc_a1                      402.6        102.3
ucc_a2                      255.6         39.3
ucc_a3                        2.9          9.9
ucc_g1                        1.3          0.5
ucc_g2                        0.1          0.1
ucc_g3                        0.5          0.1
r                             0.3          0.1
----------------------------------------------

. 
. // Drop texas
. 
. use "PCSALevelData_v3.dta", clear

. drop if state=="48"
(66 observations deleted)

. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2)

. eststo clear

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood = -1510.6948
Rescale:      Log likelihood = -1209.4114
Rescale eq:   Log likelihood = -788.48451
Iteration 0:  Log likelihood = -1375.7174  (not concave)
Iteration 1:  Log likelihood = -1153.5836  (not concave)
Iteration 2:  Log likelihood = -1082.5531  (not concave)
Iteration 3:  Log likelihood = -1008.2652  (not concave)
Iteration 4:  Log likelihood = -961.28474  (not concave)
Iteration 5:  Log likelihood = -843.52773  (not concave)
Iteration 6:  Log likelihood = -777.03039  (not concave)
Iteration 7:  Log likelihood = -755.42666  (not concave)
Iteration 8:  Log likelihood = -752.61089  (not concave)
Iteration 9:  Log likelihood = -751.34088  (not concave)
Iteration 10: Log likelihood = -750.51875  (not concave)
Iteration 11: Log likelihood = -748.21696  (not concave)
Iteration 12: Log likelihood = -746.31976  (not concave)
Iteration 13: Log likelihood = -741.11044  (not concave)
Iteration 14: Log likelihood = -735.23013  
Iteration 15: Log likelihood = -724.63995  
Iteration 16: Log likelihood = -723.98433  
Iteration 17: Log likelihood = -723.98038  

                                                           Number of obs = 607
                                                           Wald chi2(0)  =   .
Log likelihood = -723.98038                                Prob > chi2   =   .

 ( 1)  [hosp_s]tot_pop = 1
 ( 2)  [ucc_s]tot_pop2 = 1
--------------------------------------------------------------------------------
               | Coefficient  Std. err.      z    P>|z|     [95% conf. interval]
---------------+----------------------------------------------------------------
hosp_s         |
       tot_pop |          1  (constrained)
---------------+----------------------------------------------------------------
hosp_v         |
         rural |   124.0872   48.69355     2.55   0.011     28.64957    219.5248
     income_pc |   4.363425    9.66452     0.45   0.652    -14.57869    23.30554
      hispanic |  -107.9106   30.30751    -3.56   0.000    -167.3123   -48.50902
 nonhisp_black |    384.338   247.1911     1.55   0.120    -100.1477    868.8236
gte_highschool |  -283.7613   161.4032    -1.76   0.079    -600.1059    32.58319
        age_65 |   414.7055   156.9301     2.64   0.008     107.1282    722.2828
     uninsured |   95.49644   193.2802     0.49   0.621    -283.3258    474.3187
---------------+----------------------------------------------------------------
hosp_f         |
cms_wage_index |   1.067438   .5544442     1.93   0.054     -.019253    2.154128
 con_intensity |   .7954114   .2585643     3.08   0.002     .2886347    1.302188
---------------+----------------------------------------------------------------
      /hosp_a1 |   158.7762   62.04961     2.56   0.011     37.16116    280.3911
      /hosp_g1 |   .2569954   .5480354     0.47   0.639    -.8171343    1.331125
---------------+----------------------------------------------------------------
ucc_s          |
      tot_pop2 |          1  (constrained)
---------------+----------------------------------------------------------------
ucc_v          |
   n_hospitals |  -73.39129   21.29674    -3.45   0.001    -115.1321   -31.65045
         rural |    74.8709   45.90229     1.63   0.103    -15.09595    164.8377
     income_pc |    -23.679   11.60496    -2.04   0.041     -46.4243   -.9336988
      hispanic |  -81.11351   56.14731    -1.44   0.149    -191.1602    28.93319
 nonhisp_black |  -357.6568   251.2976    -1.42   0.155     -850.191    134.8775
gte_highschool |   69.72388   240.4212     0.29   0.772    -401.4931    540.9409
        age_65 |   235.0893   199.8798     1.18   0.240    -156.6678    626.8465
     uninsured |   325.2548   253.0223     1.29   0.199    -170.6599    821.1694
---------------+----------------------------------------------------------------
ucc_f          |
cms_wage_index |   .3923679    .463963     0.85   0.398    -.5169828    1.301719
---------------+----------------------------------------------------------------
       /ucc_a1 |    449.217   109.6111     4.10   0.000     234.3833    664.0508
       /ucc_a2 |   227.6418   41.32035     5.51   0.000     146.6554    308.6282
       /ucc_a3 |   10.42335   12.39093     0.84   0.400    -13.86243    34.70912
       /ucc_g1 |   1.120325    .468237     2.39   0.017     .2025972    2.038052
       /ucc_g2 |   .1206006   .1195478     1.01   0.313    -.1137088    .3549099
       /ucc_g3 |    .449299   .1047017     4.29   0.000     .2440874    .6545106
            /r |   .3609106   .1193903     3.02   0.003     .1269099    .5949113
--------------------------------------------------------------------------------
(est1 stored)

. qui do "BR_EntryThreshold_Bi.do" 10000 10000 "F"

. estout *, drop(tot_pop*) cells("b(fmt(1)) se(fmt(1))") label

----------------------------------------------
                             est1             
                                b           se
----------------------------------------------
hosp_v                                        
Rural                       124.1         48.7
Income per capita             4.4          9.7
Hispanic                   -107.9         30.3
Black                       384.3        247.2
High school or more        -283.8        161.4
Age 65 or more              414.7        156.9
Uninsured                    95.5        193.3
----------------------------------------------
hosp_f                                        
CMS wage index                1.1          0.6
CON laws                      0.8          0.3
----------------------------------------------
/                                             
hosp_a1                     158.8         62.0
hosp_g1                       0.3          0.5
----------------------------------------------
ucc_v                                         
Additional hospita~e        -73.4         21.3
Rural                        74.9         45.9
Income per capita           -23.7         11.6
Hispanic                    -81.1         56.1
Black                      -357.7        251.3
High school or more          69.7        240.4
Age 65 or more              235.1        199.9
Uninsured                   325.3        253.0
----------------------------------------------
ucc_f                                         
CMS wage index                0.4          0.5
----------------------------------------------
/                                             
ucc_a1                      449.2        109.6
ucc_a2                      227.6         41.3
ucc_a3                       10.4         12.4
ucc_g1                        1.1          0.5
ucc_g2                        0.1          0.1
ucc_g3                        0.4          0.1
r                             0.4          0.1
----------------------------------------------

. 
. // HSA market definition
. 
. use "HSALevelDataProcessed_R2.dta", clear

. drop cat_ucc cat_hosp

. gen cat_ucc = n_urgentcare

. replace cat_ucc = 3 if cat_ucc>3
(935 real changes made)

. gen cat_hosp = n_hospitals

. replace cat_hosp = 1 if cat_hosp>1
(1,397 real changes made)

. gen cat_hosp2 = n_hospitals

. replace cat_hosp2 = 0 if cat_hosp2<=1
(1,724 real changes made)

. replace cat_hosp2 = 1 if cat_hosp2>=2
(1,397 real changes made)

. gen cat_aucc = n_hospaffucc_geo

. replace cat_aucc = 1 if cat_aucc>1
(705 real changes made)

. gen n_ucc_aucc = n_urgentcare + n_hospaffucc_geo

. gen cat_both = n_ucc_aucc

. replace cat_both = 4 if cat_both>4
(931 real changes made)

. gen any_aucc = (n_hospaffucc_geo>0)

. gen any_ucc = (n_urgentcare>0) 

. ren n_hospitals og_n_hospitals

. gen n_hospitals = og_n_hospitals

. replace n_hospitals = cat_hosp2
(3,121 real changes made)

. ren n_hospaffucc_geo og_n_hospaffucc_geo

. gen n_hospaffucc_geo = og_n_hospaffucc_geo

. replace n_hospaffucc_geo = cat_aucc
(705 real changes made)

. ren n_urgentcare og_n_urgentcare 

. gen n_urgentcare = og_n_urgentcare

. replace n_urgentcare = cat_ucc
(935 real changes made)

. 
. ml clear

. ml model lf brentry_bioprobit_neg (hosp_s:cat_hosp2 = tot_pop, nocons) (hosp_v:cat_hosp2 = rural
>  income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, nocons) (hosp_f:cat_hosp2 = c
> ms_wage_index con_intensity, nocons) /hosp_a1 /hosp_g1 (ucc_s:cat_ucc = tot_pop2, nocons) (ucc_v
> :cat_ucc = n_hospitals rural income_pc hispanic nonhisp_black gte_highschool age_65 uninsured, n
> ocons) (ucc_f:cat_ucc = cms_wage_index, nocons) /ucc_a1 /ucc_a2 /ucc_a3 /ucc_g1 /ucc_g2 /ucc_g3 
> /r, constraints(1 2)

. eststo: ml max, difficult iterate(200) tolerance(1e-4) ltolerance(1e-5)

Initial:      Log likelihood =     -<inf>  (could not be evaluated)
Feasible:     Log likelihood = -7953.0236
Rescale:      Log likelihood = -6323.6796
Rescale eq:   Log likelihood = -4459.2441
Iteration 0:  Log likelihood = -7335.7559  (not concave)
Iteration 1:  Log likelihood = -5020.2395  (not concave)
Iteration 2:  Log likelihood = -4435.9379  (not concave)
Iteration 3:  Log likelihood = -4250.9016  (not concave)
Iteration 4:  Log likelihood = -4211.0297  (not concave)
Iteration 5:  Log likelihood = -4188.9715  (not concave)
Iteration 6:  Log likelihood = -4173.9909  (not concave)
